<!--
 * @Description: 图片
 * @Author: huacong
 * @Date: 2020-05-21 16:05:16
 * @LastEditTime: 2020-08-13 15:48:01
 * @LastEditors: huacong
-->
<template lang="pug">
  el-image(
    :src="url"
    style="cursor: pointer;"
    :style="{width: width, height: height}"
    :fit="mode"
    :preview-src-list="[ preview ? url : '']"
    :alt="alt"
    )
    img(:src="userDefault" slot="error" class="w h")
</template>
<script>
import userDefault from '@/assets/userDefault.png'
export default {
  name: 'AImage',
  props: {
    url: {
      type: String,
      default: ''
    },
    alt: {
      type: String,
      default: '图片'
    },
    height: {
      type: [String, Number],
      default: '64'
    },
    width: {
      type: [String, Number],
      default: '100%'
    },
    mode: {
      type: String,
      default: 'fill'
    },
    preview: {
      type: Boolean,
      default: true
    }
  },
  data () {
    return {
      userDefault
    }
  }
}
</script>
